package com.clayecloud.common.admin.controller;

import com.clayecloud.common.admin.services.ReportForRepairService;
import com.clayecloud.common.entity.ReportForRepair;
import com.clayecloud.common.utils.MessageUtil;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

@RestController
@RequestMapping("/admin/ReportForRepair")
@Api(tags = "报事报修")
public class AdminReportForRepairController {

    @Resource
    private ReportForRepairService reportForRepairService;

    @PostMapping("/insert")
    @ApiOperation("增加报事报修工单")
    public MessageUtil insert(ReportForRepair reportForRepair){
        return reportForRepairService.insertSelective(reportForRepair);
    }

    @DeleteMapping("/delete")
    @ApiOperation("删除报事报修工单")
    public MessageUtil delete(Long rrID){
        return reportForRepairService.deleteByPrimaryKey(rrID);
    }

    @PutMapping("/update")
    @ApiOperation("更新报事报修工单")
    public MessageUtil update(ReportForRepair reportForRepair){
        return reportForRepairService.updateByPrimaryKeySelective(reportForRepair);
    }

    @GetMapping("/selectAll")
    @ApiOperation("查询报事报修工单")
    public MessageUtil selectAll(Integer size, Integer page){
        return reportForRepairService.selectAll(size, page);
    }

}
